fix(gpu): tear down cuda-lts VHD prebake on GRID nodes before managed install - #8919
Conversation
… install The shared Ubuntu VHD prebakes only the cuda(-lts) driver plus a DKMS marker. A GRID / converged (A10, NVv5) node then installs the grid driver on top, and the stale prebaked cuda module + its /usr/bin/lib64 userspace libs collide with the grid driver, so nvidia-smi fails with "Failed to initialize NVML: Driver/library version mismatch". The existing cleanUpPrebakedGPUDriver only runs on nodes that do NOT install a managed driver (GPU_NODE != true OR skip), so managed GRID nodes keep the stale prebake. This adds cleanUpGridNodeCudaPrebake, run from ensureGPUDrivers before the configGPUDrivers/validateGPUDrivers dispatch (so both paths are covered), which tears down the prebake when this node installs grid and the marker is not grid (a cuda or legacy kind-less marker). Pure driver-kind mismatch, so no version comparison is needed. CUDA nodes are intentionally untouched. Scoped to the GRID mismatch only; the NAP cuda same-kind/different-version case is addressed separately by aligning the driver version NAP requests with the baked image.
There was a problem hiding this comment.
Pull request overview
Adds a targeted cleanup step for Ubuntu GRID nodes to remove a mismatched CUDA(-lts) driver prebake marker/install before the managed GRID driver path runs, preventing NVML “Driver/library version mismatch” failures on GRID / NVv5 (A10) nodes booting the shared prebaked Ubuntu VHD.
Changes:
- Introduces
cleanUpGridNodeCudaPrebakeand invokes it early inensureGPUDriverson Ubuntu before the config/validate dispatch. - Uses the existing prebake DKMS marker to decide teardown (only keep when marker kind is explicitly
grid). - Adds ShellSpec coverage for the teardown decision logic.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| parts/linux/cloud-init/artifacts/cse_config.sh | Adds GRID-vs-CUDA prebake mismatch teardown logic and hooks it into ensureGPUDrivers for Ubuntu. |
| spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh | Adds ShellSpec tests validating teardown/no-op decisions for cleanUpGridNodeCudaPrebake. |
| It 'is a no-op when no prebake marker exists' | ||
| GPU_DKMS_MARKER_FILE="$(mktemp)"; rm -f "${GPU_DKMS_MARKER_FILE}" | ||
| NVIDIA_GPU_DRIVER_TYPE="grid" | ||
| When call cleanUpGridNodeCudaPrebake | ||
| The output should not include "STUB_TEARDOWN_CALLED" | ||
| The status should be success | ||
| End | ||
| End |
There was a problem hiding this comment.
Good catch — added a non-Ubuntu no-op test in 57123d6. It sets OS=MARINER with a mismatched cuda marker + grid node and asserts cleanUpPrebakedGPUDriver is not called (and exit 0), guarding the OS != UBUNTU_OS_NAME early return against accidental removal/inversion. Mirrored to the 0702 backport (#8918).
|
Note on CI: the
All checks relevant to this change pass: shellcheck, shellspec, go-test, Pester, cue, dcgm-compatibility. Leaving the |
Addresses Copilot review on #8919: cover the OS != UBUNTU_OS_NAME early return so a regression that removes or inverts the Ubuntu gate is caught.
Addresses Copilot review on #8919: cover the OS != UBUNTU_OS_NAME early return so a regression that removes or inverts the Ubuntu gate is caught.
…to v20260702] (#8921) Co-authored-by: aks-node-assistant[bot] <190555641+aks-node-assistant[bot]@users.noreply.github.com>
…to v20260709] (#8924) Co-authored-by: aks-node-assistant[bot] <190555641+aks-node-assistant[bot]@users.noreply.github.com>
Summary
Fixes
nvidia-smifailing with "Failed to initialize NVML: Driver/library version mismatch" on agentpool GRID / converged A10 (NVv5) nodes and NAP GRID nodes booting the CUDA-prebaked shared Ubuntu VHD.Root cause: the shared Ubuntu VHD prebakes only the
cuda(-lts)driver + a DKMS marker (#8786/#8803). The existingcleanUpPrebakedGPUDriveronly runs on nodes that do not install a managed driver (GPU_NODE != trueOR skip). A GRID node installs thegriddriver on top of the stale prebakedcudamodule +/usr/bin/lib64libs, and the two collide → NVML mismatch.Fix
Add
cleanUpGridNodeCudaPrebake, invoked fromensureGPUDriversbefore theconfigGPUDrivers/validateGPUDriversdispatch (so both install paths are covered). It tears down the prebake when:grid/grid-v20), andcudamarker, or a legacy marker with nodriver_kind=line.Pure driver-kind mismatch, so no version comparison is needed. Reuses
cleanUpPrebakedGPUDriverfor removal (also clears/usr/bin/lib64+ the DKMS registration). No-op when there is no prebake marker (older / non-prebake VHDs) or on a CUDA node.Scope
GRID mismatch only. CUDA nodes are intentionally untouched — the NAP cuda same-kind / different-version case is a separate issue, addressed by aligning the driver version NAP requests with the baked image.
Branch strategy
This is the main-targeted PR (source of truth) so future VHDs cut from
maincarry the fix. The same commit is cherry-picked to the live prebake-enabled release branch(es) as separate backport PRs (starting withofficial/v20260702, #8918).Test plan
cse_config_spec.sh(cleanUpGridNodeCudaPrebake)🤖 Generated with Claude Code